<?php header("Content-type: application/xml")?>
<?php echo '<?xml version="1.0"?>' . "\n"?>
<markers>
<?php
require_once '../classes/Marker.class.php';
require_once '../classes/XmlTool.class.php';
$city = $_REQUEST['city'];
$name = $_REQUEST['name'];
$where = array();
$where['city_id'] = $city;
if (!empty($name)) {
    $where['name'] = $name;
}
$markers = Marker::find($where);
?>
<?php foreach($markers as $marker): ?>
<?php $icon = $marker->getBookable() ? "agenda.gif" : "info.gif" ?>
<marker
    lat='<?php echo $marker->getLatitude()?>'
    lng='<?php echo $marker->getLongitude()?>'
    fuck='<?php echo $marker->getId()?>'
    html='<?php echo XmlTool::encode(
        "<div class=\"location\">".
        "<h1>{$marker->getName()}</h1>".
        "{$marker->getAddress()}<br/>".
        "{$marker->getDescription()}<br/>".
        "<a href=\"/reservas.php?id={$marker->getId()}\">Informaci&oacute;n y reservas</a>".
        "<br/>".
        "</div>"
    )?>'
    label='<?php echo XmlTool::encode("<img src=\"img/{$icon}\"/>{$marker->getName()}")?>'
    is_bookable='<?php echo $marker->getBookable()?>'
/>
<?php endforeach?>
</markers>
